<?xml version="1.0" encoding="utf-8" ?>
<Mapping xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
	<Entity type="ValueTypes" table="ValueTypes">
		<Id field="Id" >
			<Generator name="guid" />
		</Id>
		<Attribute name="decimal" db-type="Currency"/>
		<Attribute name="uint" db-type="Int64" />
		<Attribute name="byte" db-type="Byte" />
		<Attribute name="ulong" db-type="Binary" size="1024" />
		<Attribute name="string" db-type="String" size="255"/>
		<Attribute name="int" db-type="Int32" />
		<Attribute name="ushort" db-type="Int32" />
		<Attribute name="bool" db-type="Boolean" />
		<Attribute name="double" db-type="Double"  />
		<Attribute name="sbyte" db-type="Int16" />
		<Attribute name="long" db-type="Int64" />
		<Attribute name="short" db-type="Int16" />
		<Attribute name="float" db-type="Single" />
		<Attribute name="char" db-type="AnsiStringFixedLength" size="1"  />
		<Attribute name="object" db-type="Object" />
		<Attribute name="object2" db-type="Object" />
	</Entity>

	<Entity type="Person" table="Person" discriminator-field="Type" discriminator-value="Person">
		<Id field="PersonId" >
			<Generator name="guid" />
		</Id>
		<Attribute name="Age" field="Age" db-type="Int32" />
		<Attribute name="Lastname" field="Lastname" db-type="AnsiString" size="255" />
		<Attribute name="Firstname" field="Firstname" db-type="AnsiString" size="36" />
    <Attribute name="Acceleration" field="Acceleration" db-type="Decimal" scale="14" precision="28"/>
    <Attribute name="ShortDescription" field="ShortDescription" db-type="AnsiString" size="255" />
    <Attribute name="Date" field="Date" db-type="DateTime"/>
		<!--<Attribute name="ShortDescription" field="ShortDescription" db-type="AnsiString" size="255"/>-->

		<Reference name="Prout" entityChild="Person" discriminator-field="Role">
			<Rule parentField="PersonId" childTable="IndexTable" childField="FK_Parent" />
			<Rule parentField="FK_Child" childTable="Person" childField="PersonId" />
		</Reference>

		<Reference name="Partners" entityChild="Person" discriminator-field="Role">
			<Rule parentField="PersonId" childTable="IndexTable2" childField="FK_Parent" constraint="Person_Partners_FK_Parent"/>
			<Rule parentField="FK_Child" childTable="Person" childField="PersonId" constraint="Person_Partners_FK_Child"/>
		</Reference>

		<Reference name="Brother" entityChild="Person" discriminator-field="Role">
			<Rule parentField="PersonId" childTable="IndexTable" childField="FK_Parent" />
			<Rule parentField="FK_Child" childTable="Person" childField="PersonId" />
		</Reference>

		<Reference name="Friends" entityChild="Thing" discriminator-field="Role">
			<Rule parentField="PersonId" childTable="IndexTable" childField="FK_Parent" />
			<Rule parentField="FK_Child" childTable="Thing" childField="PersonId" />
		</Reference>

		<Reference name="ToMany" entityChild="Thing" >
			<Rule parentField="PersonId" childTable="Thing" childField="FK_ToMany" />
		</Reference>

		<Reference name="Subsidiaries" entityChild="Person" discriminator-field="Role">
			<Rule parentField="PersonId" childTable="IndexTable" childField="FK_Parent" />
			<Rule parentField="FK_Child" childTable="Person" childField="PersonId" />
		</Reference>

		<Reference name="MyCompany" entityChild="Company" discriminator-field="Role">
			<Rule parentField="PersonId" childTable="IndexTable" childField="FK_Parent" />
			<Rule parentField="FK_Child" childTable="Company" childField="CompanyId" />
		</Reference>

		<Reference name="Address" entityChild="Address" discriminator-field="Role">
			<Rule parentField="PersonId" childTable="IndexTable" childField="FK_Parent" />
			<Rule parentField="FK_Child" childTable="Address" childField="AddressId" />
		</Reference>

		<Reference name="BestFriend" entityChild="Person">
			<Rule parentField="FK_BestFriend" childTable="Person" childField="PersonId" />
		</Reference>

		<Reference name="MyKind" entityChild="Kind" discriminator-field="Role">
			<Rule parentField="PersonId" childTable="IndexTable" childField="FK_Parent" />
			<Rule parentField="FK_Child" childTable="Company" childField="KindId" />
		</Reference>
	</Entity>

	<Entity type="Kind" table="Kind" discriminator-field="Type" discriminator-value="Kind">
		<Id field="KindId" >
			<Generator name="guid" />
		</Id>
		<Attribute name="Name" field="Name" db-type="AnsiString" size="255"/>
		<Attribute name="Value" field="Value" db-type="Int32"/>
	</Entity>

	<Entity type="Employee" table="Person" discriminator-field="Type" discriminator-value="Employee">
		<Id field="PersonId" >
			<Generator name="guid" />
		</Id>
		<Attribute name="Salary" field="Salary" db-type="Double"/>
	</Entity>

	<Entity type="Worker" table="Person" discriminator-field="Type" discriminator-value="Worker">
		<Id field="PersonId" >
			<Generator name="guid" />
		</Id>
		<Attribute name="Place" field="Place" db-type="String"/>
	</Entity>

	<Entity type="Address" table="Address">
		<Id field="AddressId" >
			<Generator name="guid" />
		</Id>
		<Attribute name="City" field="City" db-type="String"/>
	</Entity>

	<Entity type="Secretary" table="Person" discriminator-field="Type" discriminator-value="Secretary">
		<Id field="PersonId" >
			<Generator name="guid" />
		</Id>
		<Attribute name="Bonus" field="Bonus" db-type="Int32"/>
	</Entity>

	<Entity type="Thing" table="Thing">
		<Id field="PersonId" >
			<Generator name="guid" />
		</Id>
		<Attribute name="Firstname" field="Firstname" db-type="AnsiString" size="255" />
		<Attribute name="Lastname" field="Lastname" db-type="AnsiString" size="255" />
	</Entity>

	<Entity type="Manager" table="Manager">
		<Id field="Id" >
			<Generator name="guid" />
		</Id>
		<Reference name="MyCompany" entityChild="Company">
			<Rule parentField="FK_Company" childTable="Company" childField="CompanyId" />
		</Reference>
	</Entity>

	<Entity type="Company" table="Company">
		<Id field="CompanyId" >
			<Generator name="guid" />
		</Id>
		<Attribute name="Name" field="Name" db-type="AnsiString" size="255" />
	</Entity>

	<Entity type="FlaggedCategory" table="FlaggedCategory">
		<Id field="Id" >
			<Generator name="guid" />
		</Id>
		<Attribute name="FlaggedCategory" field="FlaggedCategory" db-type="AnsiString" size="255" />
	</Entity>

	<Entity type="Category" table="Category">
		<Id field="Id" >
			<Generator name="guid" />
		</Id>
		<Attribute name="Category" field="Category" db-type="AnsiString" size="255" />
	</Entity>

	<Entity type="SerializableTypes" table="SerializableTypes">
		<Id field="Id" >
			<Generator name="guid" />
		</Id>
		<Attribute name="StringCollection" field="StringCollection"	db-type="Binary" size="1024" />
	</Entity>

	<Entity type="ComplexTypes" table="ComplexTypes">
		<Id field="Id" >
			<Generator name="guid" />
		</Id>
		<Attribute name="array2" field="array2" db-type="Binary" size="1024" />
		<Attribute name="array1" field="array1" db-type="Binary" size="1024" />
		<Attribute name="datetime" field="datetime" db-type="DateTime" />
		<Attribute name="timespan" field="timespan" db-type="Object" />
	</Entity>

	<Entity type="ValueNamed" table="ValueNamed">
		<Id field="ValueNamedId">
			<Generator name="guid" />
		</Id>
		<Attribute name="Name" field="Name" db-type="AnsiString" size="1024" />
		<Attribute name="IsValueType" field="IsValueType" db-type="Boolean" />
		<Attribute name="ValueType" field="ValueType" db-type="AnsiString" size="1024" />
	</Entity>

	<Entity type="Student" table="Student">
		<Id field="StudentId">
			<Generator name="guid" />
		</Id>
		<Attribute name="Name" field="Name" db-type="AnsiString" size="255" />
		<Reference name="MyCourse" entityChild="Course">
			<Rule parentField="FK_CourseId" childTable="Course" childField="CourseId" />
		</Reference>
	</Entity>

	<Entity type="Course" table="Course">
		<Id field="CourseId">
			<Generator name="guid" />
		</Id>
		<Attribute name="Subject" field="Subject" db-type="AnsiString" size="255" />
		<Attribute name="NbHours" field="NbHours" db-type="Int32" />
	</Entity>

	<Entity type="Shape" table="Shape" discriminator-field="Type" discriminator-value="Shape">
		<Id field="ShapeId">
			<Generator name="guid" />
		</Id>
		<Attribute name="Name" field="Name" db-type="AnsiString" size="255" />
		<Attribute name="Position" field="Pos" db-type="Int32" />

	</Entity>

	<Entity type="Figure" table="Shape" discriminator-field="Type" discriminator-value="Figure" >
		<Id field="ShapeId" >
			<Generator name="guid" />
		</Id>

		<Reference name="Shapes" entityChild="Shape">
			<Rule parentField="ShapeId" childTable="Shape" childField="FK_FigureId" />
		</Reference>
	</Entity>

	<Entity type="Circle" table="Shape" discriminator-field="Type" discriminator-value="Circle" >
		<Id field="ShapeId" >
			<Generator name="guid" />
		</Id>
		<Attribute name="Size" field="Radius" db-type="Int32"/>
	</Entity>

	<Entity type="Line" table="Shape" discriminator-field="Type" discriminator-value="Line" >
		<Id field="ShapeId" >
			<Generator name="guid" />
		</Id>
		<Attribute name="PositionEnd" field="Size" db-type="Int32"/>
	</Entity>

	<Entity type="Square" table="Shape" discriminator-field="Type" discriminator-value="Square" >
		<Id field="ShapeId" >
			<Generator name="guid" />
		</Id>
		<Attribute name="Size" field="Length" db-type="Int32"/>
	</Entity>

	<Entity type="Rectangle" table="Shape" discriminator-field="Type" discriminator-value="Rectangle" >
		<Id field="ShapeId" >
			<Generator name="guid" />
		</Id>
		<Attribute name="Height" field="Height" db-type="Int32"/>
	</Entity>

	<!-- Test for linked references : pe.Load("X.YRef.ZRef") -->
	<Entity type="X" table="X">
		<Id field="XId">
			<Generator name="guid" />
		</Id>
		<Attribute name="xvalue" field="xvalue" db-type="String" size="50" />

		<Reference name="YRef" entityChild="Y">
			<Rule parentField="XId" childTable="IndexTable3" childField="FK_Parent" />
			<Rule parentField="FK_Child" childTable="Y" childField="YId" />
		</Reference>
	</Entity>

	<Entity type="Y" table="Y">
		<Id field="YId">
			<Generator name="guid" />
		</Id>
		<Attribute name="yvalue" field="yvalue" db-type="String" size="50" />

		<Reference name="ZRef" entityChild="Z">
			<Rule parentField="YId" childTable="IndexTable3" childField="FK_Parent" />
			<Rule parentField="FK_Child" childTable="Z" childField="ZId" />
		</Reference>
	</Entity>

	<Entity type="Z" table="Z">
		<Id field="ZId">
			<Generator name="guid" />
		</Id>
		<Attribute name="zvalue" field="zvalue" db-type="String" size="50" />
	</Entity>

	<Entity type="U" table="U">
		<Id field="Id">
			<Generator name="guid" />
			<!--<Generator name="native" >
				<Property name="dbType">Int32</Property>
			</Generator>-->
		</Id>
		<Attribute name="u" field="u" db-type="String" size="50" />

		<Reference name="VRef" entityChild="V">
			<Rule parentField="Id" childTable="V" childField="FK_Id" />
		</Reference>
	</Entity>

	<Entity type="V" table="V">
		<Id field="Id">
			<Generator name="guid" />
			<!--<Generator name="native" >
				<Property name="dbType">Int32</Property>
			</Generator>-->
		</Id>
		<Attribute name="v" field="v" db-type="String" size="50" />
	</Entity>

	<Entity type="B" table="A" discriminator-field="Type" discriminator-value="B">
		<Id field="Id" >
			<Generator name="guid" />
			<!--<Generator name="native">
				<Property name="dbType">Int32</Property>
			</Generator>-->
		</Id>
		<Attribute name="a" field="a" db-type="AnsiString" size="255" />
		<Attribute name="b" field="b" db-type="AnsiString" size="255" />
	</Entity>

	<Entity type="C" table="A" discriminator-field="Type" discriminator-value="C">
		<Id field="Id" >
			<Generator name="guid" />
			<!--<Generator name="native">
				<Property name="dbType">Int32</Property>
			</Generator>-->
		</Id>
		<Attribute name="a" field="a" db-type="AnsiString" size="255" />
		<Attribute name="c" field="c" db-type="AnsiString" size="255" />
	</Entity>

	<Entity type="Test:D" table="D" discriminator-field="Type" discriminator-value="Test:D">
		<Id field="Id">
			<Generator name="guid" />
		</Id>
		<Attribute name="d" field="d" db-type="AnsiString" size="255" />

		<Reference name="Refs" entityChild="Test:E" discriminator-field="Role">
			<Rule parentField="Id" childTable="IndexTable" childField="FK_Parent" />
			<Rule parentField="FK_Child" childTable="E" childField="Id" />
		</Reference>
	</Entity>

	<Entity type="Test:D_Sub" table="D" discriminator-field="Type" discriminator-value="Test:D_Sub">
		<Id field="Id" >
			<Generator name="guid" />
		</Id>
		<Attribute name="d" field="d" db-type="AnsiString" size="255" />
		<Attribute name="dp" field="dp" db-type="AnsiString" size="255" />

		<Reference name="Refs" entityChild="Test:E" discriminator-field="Role">
			<Rule parentField="Id" childTable="IndexTable" childField="FK_Parent" />
			<Rule parentField="FK_Child" childTable="E" childField="Id" />
		</Reference>
	</Entity>

	<Entity type="Test:E" table="E" discriminator-field="Type" discriminator-value="Test:E">
		<Id field="Id">
			<Generator name="guid" />
		</Id>
		<Attribute name="e" field="e" db-type="AnsiString" size="255" />
	</Entity>

	<Entity type="Test:F" table="E" discriminator-field="Type" discriminator-value="Test:F">
		<Id field="Id">
			<Generator name="guid" />
		</Id>
		<Attribute name="e" field="e" db-type="AnsiString" size="255" />
		<Attribute name="f" field="f" db-type="AnsiString" size="255" />
	</Entity>


	<Entity type="Test:G" table="E" discriminator-field="Type" discriminator-value="Test:G">
		<Id field="Id" >
			<Generator name="guid" />
		</Id>
		<Attribute name="e" field="e" db-type="AnsiString" size="255" />
		<Attribute name="f" field="f" db-type="AnsiString" size="255" />
		<Attribute name="g" field="g" db-type="AnsiString" size="255" />
	</Entity>

	<!-- Test Carole -->

	<Entity type="Test:Contract" table="Test_Contract">
		<Id field="ContractId">
			<Generator name="guid" />
			<!--<Generator name="native">
				<Property name="dbType">Int32</Property>
			</Generator>-->
		</Id>
		<Attribute name="Heading" field="Heading" db-type="String" size="50" />
		<Reference name="MyCompany" entityChild="Test:Company">
			<Rule parentField="CompanyId" childTable="Test_Company" childField="CompanyId" />
		</Reference>
	</Entity>
	<Entity type="Test:Company" table="Test_Company">
		<Id field="CompanyId">
			<Generator name="guid" />
			<!--<Generator name="native">
				<Property name="dbType">Int32</Property>
			</Generator>-->
		</Id>
		<Attribute name="Name" field="Name" db-type="String" size="50" />
	</Entity>

	<!-- UniCode Characters -->
	<Entity type="StringType" table="StringType">
		<Id field="StrId">
			<Generator name="guid" />
		</Id>
		<Attribute name="Str" field="Str"  db-type="AnsiString" size="10" />
		<Attribute name="UnicodeStr" field="UnicodeStr" db-type="String" size="1000"/>
		<Attribute name="StrText" field="StrText" db-type="AnsiString" size="100" />
		<Attribute name="UnicodeStrText" field="UnicodeStrText" db-type="String" size="100" />
	</Entity>
</Mapping>
